@extends('layouts.root')

@section('title', 'Index')

@section('css')
    <link href="{{url('/css/redactor.css')}}" rel="stylesheet">
    <style>
        .w-100{width: 100%}
        hr{margin: 8px 0}
        .icon{margin-top: -28px;margin-left: 10px}
        .html img{width: 100%}
    </style>
@endsection

@section('content')
    <div class="container">
        <div class="nav navbar-fixed-top" style="background-color: #2aabd2">
            <h6 class="text-center">Record Info</h6>
            <span class="glyphicon glyphicon-chevron-left icon" onclick="window.history.back()"></span>
        </div>
        <div class="col-lg-12" style="margin-top: 50px">
            @if (!empty($record))
                <div class="w-100">
                    <span>Name:</span>
                    <strong class="pull-right">{{$record->name or ''}}</strong>
                    <hr>
                </div>
                <div class="w-100">
                    <span>Sex:</span>
                    <strong class="pull-right">{{$record->sex or ''}}</strong>
                    <hr>
                </div>
                <div class="w-100">
                    <span>Seria Number:</span>
                    <strong class="pull-right">{{$record->serial_number or ''}}</strong>
                    <hr>
                </div>
                <div class="w-100">
                    <span>Date:</span>
                    <b class="pull-right">{{date( 'Y-m-d', strtotime($record->date))}}</b>
                    <hr>
                </div>

                <div class="w-100">
                    <span>Common:</span>
                    <p>{{$record->common or ''}}</p>
                    <hr>
                </div>
                @if (!empty($record->images))
                    @foreach(json_decode($record->images) as $image)
                        <img src="{{url($image)}}" width="100%" class="img-rounded" style="margin-top: 5px">
                    @endforeach
                @endif
                <hr>
                <div class="w-100 html">
                    {{new \Illuminate\Support\HtmlString($record->description)}}
                </div>
            @endif
        </div>
    </div>
    <hr>
    <div class="container">
        <p>Record Ow</p>
        @if (!empty($childs))
            @foreach($childs as $child)
                <a href="{{url('/record/child/' . $child->id)}}">
                    <div style="margin: 10px auto;border-bottom: 1px solid #ddd">{{$child->title}}</div>
                </a>
            @endforeach
        @endif
    </div>
    <div style="position: fixed; right: 50px; bottom: 50px">
        <a href="#" class="btn btn-danger">Link</a>
    </div>
@endsection